package com.jwdf.uda.view.popup;

import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.PopupWindow;

/**
 * 类说明：
 */
public abstract class BasePopupWindow extends PopupWindow {
    protected abstract View onInflateView(LayoutInflater inflater);
    protected abstract void onInitView(View view);

    protected Context mContext;
    public BasePopupWindow(Context context){
        super(context);
        mContext = context;
        setFocusable(true);
        setOutsideTouchable(true);
        setBackgroundDrawable(new BitmapDrawable());

        LayoutInflater inflater = LayoutInflater.from(context);
        View view = onInflateView(inflater);
        onInitView(view);
        setContentView(view);

        setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
        setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
    }

    protected Context getContext(){
        return mContext;
    }

}
